package com.yuanian.ecsplus.template;

import com.yuanian.ecsplus.exception.EcsPlusException;

import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;

public abstract class BaseTemplate {

    protected Class getClazz() {
        try {
            Type type = this.getClass().getGenericSuperclass();
            ParameterizedType parameterizedType = (ParameterizedType) type;
            Type clz = parameterizedType.getActualTypeArguments()[0];
            Class clazz = Class.forName(clz.getTypeName());
            return clazz;
        } catch (ClassNotFoundException e) {
            throw new EcsPlusException(e.getCause());
        }
    }

    protected String getCurrentUserId() {
        return "userId";
    }

}
